
#include <iostream>
using namespace std;

#define SIZE 100

typedef struct tester{
    string name;
    int age;
}TEST;

template <class Qtype> class myQueue {
    Qtype queue[SIZE];
    int first, last;

    public:

    myQueue(){
        first = 0; last = 0;
    }

    void enQueue(Qtype newElem){
        if(last+1 == first || (last+1 == SIZE && first == 0)){
            cout << "Error, queue is full!" << endl;
            return;}

        last++;
        if(last==SIZE)
            last = 0;
        cout << "Enqueueing " << newElem << " at position " << last << endl;
        queue[last] = newElem;
    }

    Qtype deQueue(){
        if(first == last){
            cout << "You tried getting object from empty queue!" << endl;
            //return NULL; <-- replace with throw statement plx
            }

        first++;
        if(first==SIZE)
            first = 0;

        cout << "Hai!, I am returning " << queue[first] << " from position " << first << endl;
        return queue[first];
    }
};

int main(string args[]){
    TEST t;

    myQueue<int> q;
    myQueue<string> q;
    myQueue<MyOwnClass> q;

    q.enQueue(10);
    q.enQueue(20);
    q.enQueue(30);



    cout << q.deQueue() << endl;
    cout << q.deQueue() << endl;
    cout << q.deQueue() << endl;


    return 0;
}
